<template>
  <div v-show="showDialog" id="detect-teacher">
    <div id="detection-box"></div>
  </div>
</template>

<script>
let eventEmitter = BJY.eventEmitter

export default {
  components: {},
  data () {
    return {
      showDialog: false,
      detectionNew: null
    }
  },
  computed: {},
  watch: {},
  methods: {
  },
  created () {
    let that = this
    eventEmitter
      .on(
        'ZWZ_DETECT',
        (e, data) => {
          that.showDialog = true
          if(!that.detectionNew){
            that.detectionNew = BJY.DetectionNew.create({
                el: $('#detection-box')[0],
                props: {
                    onDetectResult: function(success) {
                        console.log(success ? "检测通过": "检测未通过")
                        that.showDialog = false
                    }
                }
            })
          }
        }
      )
  },
  mounted () {
  },
  beforeDestroy () { }
}
</script>

<style lang="less" scoped>
//@import url(); 引入公共css类
  
  #detect-teacher {
    position: absolute;
    z-index: 9999;
    width: 610px;
    height: 500px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  }

</style>
